<template>
  <el-scrollbar class="full-height">
    <standard-item-detail v-if="standard" v-model="postForm" :is-edit="false" :standard="standard" />
  </el-scrollbar>
</template>

<script>
import StandardItemDetail from '@/views/standard/components/StandardItemDetail'
import { deepClone } from '@/utils'
import { fetchStandard } from '@/api/standard'

const defaultProp = {
  Title: '',
  PropIdList: [],
  FileIdList: []
}

const defaultForm = {
  Title: '',
  TxType: '',
  EnvList: [],
  DataForm: [],
  SiteIdList: [],
  Remark: '',
  ApplicableList: [deepClone(defaultProp)],
  BlockDiagramList: [deepClone(defaultProp)],
  LimitList: [deepClone(defaultProp)],
  MethodList: [deepClone(defaultProp)],
  ProcedureList: [deepClone(defaultProp)],
  RequirementList: [deepClone(defaultProp)],
  UncertaintyList: [deepClone(defaultProp)],
  StandardId: ''
}

export default {
  name: 'StandardItemCreate',
  components: { StandardItemDetail },
  data() {
    return {
      postForm: deepClone(defaultForm),
      standard: null
    }
  },
  created() {
    this.fetchStandard()
  },
  methods: {
    async fetchStandard() {
      const data = await fetchStandard(this.$route.query.id)
      this.standard = data.Data
    }
  }
}
</script>

<style scoped>

</style>
